#!/usr/bin/env python3

import connexion
{{#featureCORS}}
from flask_cors import CORS
{{/featureCORS}}

from {{packageName}} import encoder


def main():
    app = connexion.App(__name__, specification_dir='./openapi/')
    app.app.json_encoder = encoder.JSONEncoder
    app.add_api('openapi.yaml',
                arguments={'title': '{{appName}}'},
                pythonic_params=True)

{{#featureCORS}}
    # add CORS support
    CORS(app.app)

{{/featureCORS}}
    app.run(port={{serverPort}})


if __name__ == '__main__':
    main()
